import request from '@/utils/request'
// mode 如果是cart购买   buyNow买，只需要携带更多参数
export const checkOrder = (mode, obj) => {
  return request.get('/checkout/order', {
    params: {
      mode, // cart，buyNow  两种方式购买
      delivery: 20, // 快递方式
      couponId: 0, // 优惠卷
      isUsePoints: 0, // 积分使用
      ...obj
    }
  })
}

// 提交订单
export const submitOrder = (mode, obj) => {
  return request.post('/checkout/submit', {
    mode,
    delivery: 20,
    couponId: 0,
    isUsePoints: 0,
    payType: 10,
    ...obj
  })
}

// 订单列表
export const getMyOrderList = (dataType, page) => {
  return request.get('/order/list', {
    params: {
      dataType,
      page
    }
  })
}
